<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>绝对定位-父元素</title>
    <style>
        *{
            padding: 0;
            margin: 0;
        }
        .parent1{
            width: 600px;
            height: 600px;
            background-color: blueviolet;
            border: 1px solid red;
            position: relative;
        }
        .parent2{
            width: 400px;
            height: 400px;
            background-color: aqua;
            margin: 100px;
            border: 1px solid blue;
            padding: 100px;
            box-sizing: border-box;
            /* position: relative; */
        }
        .child{
            width: 200px;
            height: 200px;
            background-color: red;
            /* 绝对定位 */
            position: absolute;
            top: 10px;
            left: 10px;
        }
        .static{
            width: 100px;
            height: 100px;
            background-color: blue;
        }
        /* 如果有祖先定位元素 则根据最近的祖先定位元素定位 */
    </style>
</head>
<body>
    <div class="parent1">
        <div class="parent2">
            <div class="child"></div>
        </div>
    </div>
    <div class="static">其他的元素</div>
</body>
</html>